import Router from "@koa/router";
import UserService from "../services/UserService";
import {RegisterRequest} from "../models/request/User";
import Result from "../utils/Result";

const usersRouter = new Router({ prefix: '/users' });

// 用户注册
usersRouter.post('/register', async (ctx) => {
    const id = await UserService.register(<RegisterRequest>ctx.request.body);
    ctx.body = Result.success(id);
});

export default usersRouter;